# Contributor: Bryce Vandegrift <bryce@brycevandegrift.xyz>
# Maintainer: Bryce Vandegrift <bryce@brycevandegrift.xyz>
pkgname=minipro
pkgver=0.6
pkgrel=4
pkgdesc="Program for controlling the MiniPRO TL866xx series of chip programmers"
url="https://gitlab.com/DavidGriffith/minipro"
arch="all"
license="GPL-3.0-or-later"
depends="libusb"
makedepends="git libusb-dev"
subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-udev"
options="!check" # no test suite
source="https://gitlab.com/DavidGriffith/minipro/-/archive/$pkgver/minipro-$pkgver.tar.gz"

build() {
	make -e PREFIX="/usr"
}

package() {
	make -e DESTDIR="$pkgdir" PREFIX="/usr" COMPLETIONS_DIR="/usr/share/bash-completion/completions" install
}

udev() {
	pkgdesc="$pkgdesc (udev rules)"
	install_if="$pkgname=$pkgver-r$pkgrel udev"

	cd "$builddir"
	install -Dm644 udev/60-minipro.rules -t "$subpkgdir"/usr/lib/udev/rules.d
	install -Dm644 udev/61-minipro-plugdev.rules -t "$subpkgdir"/usr/lib/udev/rules.d
	install -Dm644 udev/61-minipro-uaccess.rules -t "$subpkgdir"/usr/lib/udev/rules.d
}

sha512sums="
1c791467d4aa33dcf78b05126b7352ade3fdd9aa3220376e4fb6be346d198a51e52e5240f8d8d8aa80ce0a14b6808af05a071713211d53c35cc3430ae4a60b6b  minipro-0.6.tar.gz
"
